// @ts-ignore
/* eslint-disable */
import { request } from "@/utils/request";

/** 获取主题列表 分页获取主题列表，支持搜索和过滤 GET /admin/topics */
export async function adminTopics(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminTopicsParams,
  options?: { [key: string]: any }
) {
  return request<API.PageResponse & { data?: API.Topic[] }>(`/admin/topics`, {
    method: "GET",
    params: {
      // page has a default value: 1
      page: "1",
      // page_size has a default value: 20
      page_size: "20",

      ...params,
    },
    ...(options || {}),
  });
}

/** 创建主题 创建新的主题分类 POST /admin/topics */
export async function adminTopics2(
  body: API.TopicCreateRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.Topic }>(`/admin/topics`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取主题详情 根据主题ID获取主题详细信息 GET /admin/topics/${param0} */
export async function adminTopicsId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminTopicsIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.Response & { data?: API.Topic }>(
    `/admin/topics/${param0}`,
    {
      method: "GET",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 更新主题信息 更新指定主题的信息 PUT /admin/topics/${param0} */
export async function adminTopicsId2(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminTopicsIdParams,
  body: API.TopicUpdateRequest,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.Response & { data?: API.Topic }>(
    `/admin/topics/${param0}`,
    {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      params: { ...queryParams },
      data: body,
      ...(options || {}),
    }
  );
}

/** 删除主题 软删除指定主题 DELETE /admin/topics/${param0} */
export async function adminTopicsId3(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminTopicsIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/admin/topics/${param0}`, {
    method: "DELETE",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新主题状态 启用或禁用主题 PUT /admin/topics/${param0}/status */
export async function adminTopicsIdStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminTopicsIdStatusParams,
  body: API.TopicStatusRequest,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/admin/topics/${param0}/status`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 获取启用的主题列表 获取所有启用状态的主题，按排序顺序返回 GET /admin/topics/enabled */
export async function adminTopicsEnabled(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.Topic[] }>(
    `/admin/topics/enabled`,
    {
      method: "GET",
      ...(options || {}),
    }
  );
}

/** 搜索主题 根据关键词搜索主题 GET /admin/topics/search */
export async function adminTopicsSearch(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminTopicsSearchParams,
  options?: { [key: string]: any }
) {
  return request<API.PageResponse & { data?: API.Topic[] }>(
    `/admin/topics/search`,
    {
      method: "GET",
      params: {
        // page has a default value: 1
        page: "1",
        // page_size has a default value: 20
        page_size: "20",
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 批量更新主题排序 批量更新多个主题的排序顺序 PUT /admin/topics/sort */
export async function adminTopicsSort(
  body: API.TopicSortRequest,
  options?: { [key: string]: any }
) {
  return request<any>(`/admin/topics/sort`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取主题统计信息 获取主题相关的统计数据 GET /admin/topics/stats */
export async function adminTopicsStats(options?: { [key: string]: any }) {
  return request<API.Response & { data?: any }>(`/admin/topics/stats`, {
    method: "GET",
    ...(options || {}),
  });
}

/** 获取主题及其卡片数量 获取所有主题及其关联的卡片数量 GET /admin/topics/with-card-count */
export async function adminTopicsWithCardCount(options?: {
  [key: string]: any;
}) {
  return request<API.Response & { data?: API.TopicResponse[] }>(
    `/admin/topics/with-card-count`,
    {
      method: "GET",
      ...(options || {}),
    }
  );
}
